﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Xiaozilang_Ordering_System
{
    public partial class client : Form
    {
        DataTable SyDt = new DataTable();
        //防止退出索引值
        public static int num = 0;
        //获取当前点击的商家id
        public static string BSID;
        //获取当前点击的订单id
        public static string ORDERID;
        //获取当前点击的商家名字
        public static string BSName;

        public client()
        {
            InitializeComponent();

        }
        /*
         * 父窗体
         */
        private void Shopping_Cart_Interface_Load(object sender, EventArgs e)
        {
            Shopping_Cart.HistoricalOrders = true;
            //删除dataGridView空行
            dataGridView1.AllowUserToAddRows = false;
            dataGridView2.AllowUserToAddRows = false;
            //取消自动生成列
            dataGridView2.AutoGenerateColumns = false;
            dataGridView1.AutoGenerateColumns = false;
            dataGridView3.AutoGenerateColumns = false;
            //用户不能编辑行内容
            dataGridView2.EditMode = DataGridViewEditMode.EditProgrammatically;
            //界面数据刷新
            InterfaceRefresh();
            //给dataGridView1添加复选框
            DataGridViewCheckBoxColumn checkox = new DataGridViewCheckBoxColumn();
            //列显示的名字
            checkox.HeaderText = "选择";
            checkox.Name = "IsChecked";
            checkox.TrueValue = true;
            checkox.FalseValue = false;
            checkox.DataPropertyName = "IsChecked";
            //列宽
            checkox.Width = 50;
            //列大小不变
            checkox.Resizable = DataGridViewTriState.False;
            //添加checkox在第一列
            this.dataGridView2.Columns.Insert(0, checkox);
            this.dataGridView2.Columns["IsChecked"].FillWeight = 18;
            //首页加按钮
            AddBtndgv3();
            //个人信息
            lblusername.Text = denglu.Name1;//昵称
            lbluserStel.Text = denglu.tel;//账号
            lbluserAdd.Text = denglu.address;//地址
            //头像
            if (denglu.imagelj != null)
            {
                picHead.Image = Image.FromFile(denglu.imagelj);
            }
            //商家列表显示
            DataTable SJdt = new DataTable();
            string sql = "select * from Business";
            SJdt = DBHelper.SelectByAdapter(sql);
            dataGridView3.DataSource = SyDt;
            sy();
            for (int i = 0; i < SJdt.Rows.Count; i++)
            {
                //列表展示
                cmbshangjia.Items.Add(SJdt.Rows[i]["BSname"]);
            }
            ddColumn8.DefaultCellStyle.NullValue = "确认收到";
            sypl.DefaultCellStyle.NullValue = "评论";
        }


        /*
         * 界面数据填充
         */
        private void InterfaceRefresh()
        {
            //+-----------------------------------------------------------------
            //购物车页面显示数据
            //进入查询类方法
            Shopping_Cart.CartSelect();
            //设置datagridview的数据源
            dataGridView2.DataSource = Shopping_Cart.ds;
            //行高
            dataGridView2.RowTemplate.Height = 60;
            dataGridView3.RowTemplate.Height = 60;
            this.dataGridView2.Columns["gwimage"].FillWeight = 50;
            //用户不可改变行高
            dataGridView2.AllowUserToResizeRows = false;
            dataGridView3.AllowUserToResizeRows = false;
            plus.DefaultCellStyle.NullValue = "+";
            reduce.DefaultCellStyle.NullValue = "-";
            this.dataGridView2.Columns["plus"].FillWeight = 10;
            this.dataGridView2.Columns["reduce"].FillWeight = 10;

            //+-------------------------------------------------------------------
            //订单页面显示数据
            Shopping_Cart.OrderPage();
            dataGridView1.DataSource = Shopping_Cart.dc;
            this.dataGridView1.Columns["ddColumn7"].FillWeight = 67;
            this.dataGridView1.Columns["ddColumn10"].FillWeight = 67;
            this.dataGridView1.Columns["ddColumn6"].FillWeight = 120;
            //+--------------------------------------------------------------------

            //首页信息显示
            //--------------------------------------------------------------------------------------------------------------------------

            string sql = "select d.dName,d.unitPrice,b.BSname,d.image,d.dishID,d.BSID from Dish d join Business b on d.BSID=b.BSID";
            SyDt = DBHelper.SelectByAdapter(sql);
            dataGridView3.DataSource = SyDt;
            sy();
            //------------------------------------------------------------------------------------------------------------------------
        }
        /*
         * 购物车结算显示
         */
        //public static double allmoney = SettlementAmount.Text;
        public static double SettlementAmount = 0, SettlementAmountStorage = 0;
        //int number = 0, number1 = 0;
        private void SCSD()
        {
            SettlementAmount = 0;
            SettlementAmountStorage = 0;
            //存储计算结果
            //double SettlementAmount = 0, SettlementAmountStorage = 0;
            int number = 0, number1 = 0;
            for (int j = 0; j < Pay.odid.Length; j++)
            {
                Pay.odid[j] = null;
            }
            //结算操作
            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {
                if ((bool)dataGridView2.Rows[i].Cells[0].EditedFormattedValue)
                {
                    Pay.odid[i] = Shopping_Cart.ds.Rows[i]["odID"].ToString();
                    //数量
                    number1 = int.Parse(dataGridView2.Rows[i].Cells["gwquantity"].Value.ToString());
                    number += number1;
                    //string转换double
                    SettlementAmountStorage = System.Convert.ToDouble(dataGridView2.Rows[i].Cells["gwunitPrice"].Value.ToString());
                    SettlementAmount += SettlementAmountStorage * number1;

                }
            }
            //显示金额
            textBox12.Text = SettlementAmount.ToString();
            //显示数量
            textBox4.Text = number.ToString();
        }

        //查询条件存储
        string key = "";

        public static string cName;
        DataGridViewButtonColumn btnCol;
        private void TbSelect_TextChanged(object sender, EventArgs e)
        {
            string search = TbSelect.Text;

        }
        private void sy()
        {
            for (int i = 0; i < dataGridView3.Rows.Count; i++)

            {
                if (!Convert.IsDBNull(SyDt.Rows[i]["image"]))
                {
                    //下面两个方式都可以
                    dataGridView3.Rows[i].Cells["SyPictrue"].Value = Image.FromFile(SyDt.Rows[i]["image"].ToString().Trim());
                }

            }
        }

        //窗口关闭时相关数据的清除
        private void client_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (num == 0)
            {
                DialogResult dr = MessageBox.Show("是否退出本应用?", "提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (dr == DialogResult.OK)   //如果单击“是”按钮
                {
                    //清空购物车数据集的数据
                    if (Shopping_Cart.ds != null)
                    {
                        Shopping_Cart.ds.Clear();
                        Shopping_Cart.dc.Clear();
                    }
                    e.Cancel = false;
                    num = 4;//关闭窗体
                    Application.Exit();
                    
                }
                else if (dr == DialogResult.Cancel)
                {
                    e.Cancel = true;
                    //num = 0;//不执行操作
                }
            }
            else if (num == 1)
            {
                //跳转余额充值
                AddMoney addmoney = new AddMoney();
                addmoney.Show();
                num = 0;
            }
            else if (num == 2)
            {
                if (dataGridView2.Rows.Count!=0)
                {
                    Pay.ddColumn1OrderID = dataGridView2.CurrentRow.Cells["gwcOrderID"].Value.ToString();//订单ID
                    Pay.ddBSIDjudge = dataGridView2.CurrentRow.Cells["gwcBSID"].Value.ToString();//店铺ID
                }
                
                //结算
                Pay pay = new Pay();
                pay.ShowDialog();
                InterfaceRefresh();
                gwcImage();
                textBox12.Text = "";
                textBox4.Text = "";
                num = 0;
            }
            else if (num == 3)
            {
                //退出账号
                DialogResult dr = MessageBox.Show("是否退出账号?", "提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (dr == DialogResult.OK)   //如果单击“是”按钮
                {
                    denglu dl = new denglu();
                    dl.Show();
                    e.Cancel = false;                 //关闭窗体
                    num = 0;
                }
                else if (dr == DialogResult.Cancel)
                {
                    e.Cancel = true; num = 0;               //不执行操作
                }
            }
            
        }
        /*
         * 鼠标左键点击时图片显示
         */
        private void gwcImage()
        {

            //InterfaceRefresh2();
            //购物车图片列
            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {

                if (!Convert.IsDBNull(Shopping_Cart.ds.Rows[i]["image"]))
                {
                    //把数据库中的图片路径转换成为Image格式进行赋值                    
                    //this.dataGridView1.Rows[i].Cells["image"].Value = Image.FromFile(table.Rows[i]["weizhi"].ToString().Trim());                    
                    //用此方式加载图片可以释放其占用的进程                    
                    FileStream fileStream = new FileStream(Application.StartupPath + "\\" + Shopping_Cart.ds.Rows[i]["image"].ToString(), FileMode.Open, FileAccess.Read);
                    int byteLength = (int)fileStream.Length;
                    byte[] fileBytes = new byte[byteLength];
                    fileStream.Read(fileBytes, 0, byteLength);
                    //文件流关闭,文件解除锁定                     
                    fileStream.Close();
                    this.dataGridView2.Rows[i].Cells["gwimage"].Value = Image.FromStream(new MemoryStream(fileBytes));
                    this.dataGridView2.Rows[i].Cells["gwimage"].Tag = Application.StartupPath + "\\" + Shopping_Cart.ds.Rows[i]["image"].ToString().Substring(0, 4) + Shopping_Cart.ds.Rows[i]["image"].ToString().Substring(5);
                    //dataGridView2.Rows[i].Cells["images"].Value = Image.FromFile(Shopping_Cart.ds.Rows[i]["image"].ToString().Trim());
                }
            }
        }

        //给首页菜单增加按钮
        private void AddBtndgv3()
        {
            DataGridViewButtonColumn btn = new DataGridViewButtonColumn();
            btn.Name = "SyAdd";//添加按钮的名字
            btn.HeaderText = "加购";//添加按钮列的列名称
            btn.DefaultCellStyle.NullValue = "加车";//添加按钮显示的名字

            dataGridView3.Columns.Add(btn);//在dataGridView3的最后一列添加按钮
        }

        public static int number, bsid;
        public static string key1;
        //首页搜索按钮
        private void Bts()
        {
            DataView SyDataView = SyDt.DefaultView;
            SyDataView.RowFilter = string.Format("dName like '%{0}%'", key1);
            dataGridView3.DataSource = SyDataView;
            sy();
        }
        private void BtSelect_Click_1(object sender, EventArgs e)
        {
            if (TbSelect.Text== "菜名搜索")
            {
                key1 = "";
            }
            else
            {
                key1 = TbSelect.Text;
            }
            Bts();
        }
        /*
        *购物车全选
        */
        private void checkBox1_CheckedChanged_1(object sender, EventArgs e)
        {
            //全选
            if (checkBox1.Checked)
            {
                for (int i = 0; i < dataGridView2.Rows.Count; i++)
                {
                    if (!(bool)dataGridView2.Rows[i].Cells[0].EditedFormattedValue)
                    {
                        //选中
                        this.dataGridView2.Rows[i].Cells[0].Value = true;
                    }
                }
            }
            else if (!checkBox1.Checked)   //取消全选
            {
                for (int i = 0; i < dataGridView2.Rows.Count; i++)
                {
                    if ((bool)dataGridView2.Rows[i].Cells[0].EditedFormattedValue)
                    {
                        //不选中
                        this.dataGridView2.Rows[i].Cells[0].Value = false;
                    }
                }
            }
            //购物车结算显示
            SCSD();
        }
        /*
         * 购物车删除按钮
         */
        private void button4_Click_1(object sender, EventArgs e)
        {
            DialogResult sd = MessageBox.Show("是否确定删除?", "提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
            if (sd == DialogResult.OK)   //如果单击“是”按钮
            {
                //删除选择的行数据
                for (int i = 0; i < dataGridView2.Rows.Count; i++)
                {
                    if ((bool)dataGridView2.Rows[i].Cells[0].EditedFormattedValue)
                    {
                        Shopping_Cart.numberIns = dataGridView2.Rows[i].Cells["odID"].Value.ToString();
                        //删除所选内容
                        Shopping_Cart.DeleteButton();

                    }
                    else if ((bool)dataGridView2.Rows[i].Cells[0].EditedFormattedValue == false)
                    {
                        continue;
                    }
                }
                MessageBox.Show("删除成功！！");
                SettlementAmount = 0;
            }
            textBox12.Text = "";
            textBox4.Text = "";
            //刷新界面
            Shopping_Cart.ds.Clear();
            InterfaceRefresh();
            gwcImage();
        }
        /*
         * 购物车显示页面操作
         */
        private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1 && e.ColumnIndex != -1)
            {
                //判断checkob勾上
                if ((bool)dataGridView2.Rows[e.RowIndex].Cells[0].EditedFormattedValue == true)
                {
                    //没选中
                    this.dataGridView2.Rows[e.RowIndex].Cells[0].Value = false;
                }
                else
                {
                    //选中
                    this.dataGridView2.Rows[e.RowIndex].Cells[0].Value = true;
                }
            }
            //购物车加减方法 

            btnCol = dataGridView2.Columns[e.ColumnIndex] as DataGridViewButtonColumn;
            string sql = "";
            int number1 = 0;
            //获取当前点击的行 
            int rowss = dataGridView2.CurrentRow.Index;
            number1 = int.Parse(dataGridView2.Rows[rowss].Cells["gwquantity"].Value.ToString()); 
            if (dataGridView2.Columns[e.ColumnIndex].Name != "IsChecked")
            {
                //MessageBox.Show("当前点击的列是：" + btnCol.HeaderText + "当前点击的行是：" + rowss);
                cName = dataGridView2.Rows[rowss].Cells["odID"].Value.ToString();
                if (number1 > 0)
                {
                    if (dataGridView2.Columns[e.ColumnIndex].Name == "plus")
                    {
                        number1 += 1;
                    }
                    else
                    {
                        number1 -= 1;
                    }
                    if (number1 == 0)
                    {
                        sql = string.Format("delete from OrderDetail where odID=(select d.odID from User1 a,Dish b, Order1 c,OrderDetail d, Business e where e.BSID = b.BSID and d.dishID = b.dishID and d.orderID = c.OrderID and c.userID = a.userID and a.userID = {0} and d.number=1  and d.odID='{1}')", Shopping_Cart.UserJudge, cName);
                    }
                    else
                    {
                        sql = string.Format("update OrderDetail  set quantity='{0}'  where  odID=(select d.odID from User1 a,Dish b, Order1 c,OrderDetail d, Business e where e.BSID = b.BSID and d.dishID = b.dishID and d.orderID = c.OrderID and c.userID = a.userID and a.userID = {1} and d.number=1 and d.odID='{2}')", number1, Shopping_Cart.UserJudge, cName);
                    }
                }
                DBHelper.GetNonQuery(sql);
                Shopping_Cart.ds.Clear();
                InterfaceRefresh();
            }
            gwcImage();
            //购物车结算显示
            if (btnCol == null)
            {
                SCSD();
            }
        }

        private void textBox3_Enter_1(object sender, EventArgs e)
        {
            if (textBox3.Text == "菜名搜索")
            {
                textBox3.Text = "";
            }
        }

        private void textBox3_Leave_1(object sender, EventArgs e)
        {
            DataView se = Shopping_Cart.ds.DefaultView;
            if (textBox3.Text == "")
            {
                textBox3.Text = "菜名搜索";
                if (textBox3.Text == "菜名搜索")
                    key = "";
                //界面数据刷新
                se.RowFilter = string.Format("dName like '%{0}%'", key);
                dataGridView1.DataSource = se;
            }
            gwcImage();
        }
        //结算按钮
        private void button5_Click_1(object sender, EventArgs e)
        {
            num = 2;
            this.Close();
        }
        //订单页面确认收到按钮
        private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            if (ddColumn8.DefaultCellStyle.NullValue.ToString() == "确认收到")
            {
                //判断确定收到是那一行
                DialogResult sd = MessageBox.Show("是否确定收到?", "提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (sd == DialogResult.OK)   //如果单击“是”按钮
                {
                    Shopping_Cart.numberIns = dataGridView1.CurrentRow.Cells["ddCommentodID"].Value.ToString();//详细订单ID
                    
                    Shopping_Cart.ConfirmReceipt();
                    MessageBox.Show("确定成功！！");
                }
            }
            else
            {
                if (ddColumn8.DefaultCellStyle.NullValue.ToString() == "评论")
                {
                    BSID = dataGridView1.CurrentRow.Cells["ddBSID1"].Value.ToString();
                    ORDERID = dataGridView1.CurrentRow.Cells["ddColumn1"].Value.ToString();
                    Comment comm = new Comment();
                    comm.ShowDialog();
                }
            }
            InterfaceRefresh();
        }
        /*
        * 订单界面 历史订单按钮
        */
        private void button9_Click_1(object sender, EventArgs e)
        {
            if (button9.Text == "历史订单")
            {
                button9.Text = "订单";
                button1.Text = "欢迎来到历史订单页面";
                dataGridView1.Columns["ddColumn6"].HeaderText = "送达时间";
                ddColumn8.DefaultCellStyle.NullValue = "评论";
                Shopping_Cart.HistoricalOrders = false;
                dataGridView1.Columns["ddColumn5"].Visible = false;
                //界面更新
                InterfaceRefresh();
            }
            else if (button9.Text == "订单")
            {
                button9.Text = "历史订单";
                button1.Text = "欢迎来到订单页面";
                dataGridView1.Columns["ddColumn6"].HeaderText = "预计送达时间";
                ddColumn8.DefaultCellStyle.NullValue = "确认收到";
                Shopping_Cart.HistoricalOrders = true;
                dataGridView1.Columns["ddColumn5"].Visible = true;
                //界面更新
                InterfaceRefresh();
            }
        }

        private void textBox1_Enter_1(object sender, EventArgs e)
        {
            if (textBox1.Text == "菜名搜索")
            {
                textBox1.Text = "";
            }
        }

        private void textBox1_Leave_1(object sender, EventArgs e)
        {
            DataView sed = Shopping_Cart.dc.DefaultView;
            if (textBox1.Text == "")
            {
                textBox1.Text = "菜名搜索";
                if (textBox1.Text == "菜名搜索")
                    key = "";
                //界面数据刷新
                sed.RowFilter = string.Format("dName like '%{0}%'", key);
                dataGridView1.DataSource = sed;

            }
        }

        private void button3_Click_2(object sender, EventArgs e)
        {
            DataView sed = Shopping_Cart.dc.DefaultView;
            key = textBox1.Text;
            if (textBox1.Text == "菜名搜索")
                key = "";
            sed = Shopping_Cart.dc.DefaultView;
            sed.RowFilter = string.Format("dName like '%{0}%'", key);
            dataGridView1.DataSource = sed;
        }
        /*
         * 购物车查询方法
         */
        private void button6_Click(object sender, EventArgs e)
        {
            DataView se = Shopping_Cart.ds.DefaultView;
            key = textBox3.Text;
            if (textBox3.Text == "菜名搜索")
                key = "";

            se.RowFilter = string.Format("dName like '%{0}%'", key);
            dataGridView2.DataSource = se;
            gwcImage();
        }
        //余额充值按钮
        private void AddMoney_Click(object sender, EventArgs e)
        {
            num = 1;
            this.Close();
        }
        //查询余额
        private void SelectMoney_Click_1(object sender, EventArgs e)
        {
            SelectMoney selectMoney = new SelectMoney();
            selectMoney.ShowDialog();
            selectMoney.MdiParent = this;
            selectMoney.Text = "余额查询";
        }
        //退出账号
        private void btnExit_Click(object sender, EventArgs e)
        {
            num = 3;
            this.Close();
        }
        //修改头像
        private void picHead_Click(object sender, EventArgs e)
        {

        }
        //下拉列表
        private void cmbshangjia_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataView SyDataView = SyDt.DefaultView;
            SyDataView.RowFilter = string.Format("BSname like '{0}'", cmbshangjia.Text);
            dataGridView3.DataSource = SyDataView;
            sy();
        }

        private void lblshangjialiebiao_Click(object sender, EventArgs e)
        {

        }

        private void TbSelect_Enter(object sender, EventArgs e)
        {
            if (TbSelect.Text == "菜名搜索")
            {
                TbSelect.Text = "";
            }
        }

        private void TbSelect_Leave(object sender, EventArgs e)
        {
            if (TbSelect.Text == "")
            {
                key1 = "";
                Bts();
                TbSelect.Text = "菜名搜索";
            }
        }

        private void btnExie_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button11_Click(object sender, EventArgs e)
        {
            GeneralVariable.count1 = 3;
            Business.跳转小窗口();
            Business.Pirbox(denglu.imagelj, picHead);
            lblusername.Text = denglu.Name1;
            lbluserAdd.Text = denglu.address;
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void lblusername_Click(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void lbluserStel_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void lbluserAdd_Click(object sender, EventArgs e)
        {

        }

        //购物车图片
        private void xcl_MouseDown_1(object sender, MouseEventArgs e)
        {
            InterfaceRefresh();
            if (e.Button == MouseButtons.Left)
            {
                gwcImage();
            }
        }
        //string judgeddp = null;
        //加车按钮事件
        private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //DataView dse = Shopping_Cart.dd.DefaultView;
             bool judge = true;
            int cindex = e.ColumnIndex;
            int rindex = e.RowIndex;
            string sql = "";
            string name = dataGridView3.Rows[dataGridView3.CurrentRow.Index].Cells["SydName"].Value.ToString();
            
            if (cindex == 5)
            {
                MessageBox.Show(name);
                number = int.Parse(SyDt.Rows[rindex]["dishID"].ToString());
                bsid = int.Parse(SyDt.Rows[rindex]["BSID"].ToString());
                DataView se = Shopping_Cart.ds.DefaultView;
                /*while (judge == true)
                {
                    
                }*/
                Shopping_Cart.orderGenerationJugde();
                //judgeddp = Shopping_Cart.dl.Rows[0]["number"].ToString();
                if (Shopping_Cart.dd.Rows.Count > 0)
                {
                    se.RowFilter = string.Format("dishID = '{0}'", number);
                    if (se.Count > 0)
                    {
                        sql = string.Format("update OrderDetail set quantity+=1 where dishID='{0}' and userID='{1}'", number, Shopping_Cart.UserJudge);
                    }
                    else
                    {
                        sql = string.Format("insert into OrderDetail (dishID,quantity,number,userID,orderID) values('{0}','1','1','{1}','{2}')" +
                            "", number, Shopping_Cart.UserJudge, Shopping_Cart.dd.Rows[0]["orderID"].ToString());
                    }
                    bool re1 = DBHelper.GetNonQuery(sql);
                    //judge = false;
                }
                else
                {
                    Shopping_Cart.orderGeneration();
                    sql = string.Format("insert into OrderDetail (dishID,quantity,number,userID,orderID) values('{0}','1','1','{1}','{2}')" +
                            "", number, Shopping_Cart.UserJudge, Shopping_Cart.dl.Rows[0]["orderID"].ToString());
                    bool re = DBHelper.GetNonQuery(sql);
                    //judge = false;
                }
                InterfaceRefresh();
            }
            else
            {
                if (sypl.DefaultCellStyle.NullValue.ToString() == "评论")
                {
                    BSName = dataGridView3.CurrentRow.Cells["SyBSID"].Value.ToString();
                    BusinessReviews BR = new BusinessReviews();
                    BR.ShowDialog();
                }
            }
            
        }

    }
}
